package br.ufpe.cin.camid.sample;

import br.ufpe.cin.camid.core.objects.ManagedObject;
import br.ufpe.cin.camid.core.objects.ManagedObjectType;

@ManagedObject( type = ManagedObjectType.STATEFUL, deactivationTime = 500L )
public class ConcreteBuffer implements Buffer {

	private Integer val = 0;
	
	@Override
	public void set(Integer val) 
	{
		if(val.intValue() >= 0)
		{
			this.val = val;
		}
		else
		{
			throw new NegativeBufferValueException();
		}
	}

	@Override
	public Integer get() 
	{
		return val;
	}
	
}
